<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>表单绑定</title>
    <!-- <script src="https://unpkg.com/vue@3.5.21/dist/vue.global.js"></script> -->
    <script src="../assets/vue3.js"></script>

    <style>
       
    </style>
</head>

<body>
    <div id="app">
      
        <form action="">
            

            <!--  表单 -->
                
                <div>
                    用户名:  <input type="text" name="username" v-model="form.username">
                </div>
                <div>
                    密码:  <input type="password" autocomplete="off"  name="password" v-model="form.password">
                </div>

                <div>
                    性别:
                    男<input type="radio" name="gender"   value="男" v-model="form.gender">
                    女<input type="radio" name="gender"   value="女" v-model="form.gender">
                </div>

                 <div>
                    是否及格:
                    及格<input type="radio" name="pass"  value="及格" v-model="form.pass">
                    不及格<input type="radio" name="pass"   value="不及格" v-model="form.pass">
                </div>
                 <div>
                    爱好:
                    <input type="checkbox" name="pass"  value="足球" v-model="form.favs">足球
                    <input type="checkbox" name="pass"   value="篮球" v-model="form.favs">篮球
                    <input type="checkbox" name="pass"   value="跳舞" v-model="form.favs">跳舞
                </div>

                <div>

                    <!-- 表示可以多选 -->
                     国籍：<select v-model="form.nationality" >
                            <option value="0">中国</option>
                            <option value="1">美国</option>
                            <option value="2">英国</option>
                        </select><br>
                </div>

                <div>

                    个人简介：<textarea v-model="form.brief" rows="5" cols="30"> </textarea><br>
                </div>



            <!-- form中的按钮默认提交表单 -->
            <button @click="saveuser" type="button">添加按钮</button>
        </form>

    </div>



    <script>
        let app = Vue.createApp({
            data() {
                return {
                    form:{
                      username:'',
                      password:'',
                      gender:'',
                      age:0 ,
                      pass :'' ,
                      favs:[] ,
                      nationality:'' ,
                      brief:'adsafdsafsaf'
                    },
                   
                }
            },
            methods:{
                saveuser(){
                    console.log("this.form",this.form);
                    
                }
            }

        }).mount("#app")
    </script>
</body>

</html>